<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="./reset.min.css">
		<style>
			html,body{
				background-color: pink;
				height:200%;
			}
			#box{
				position: absolute;
				left:200px;
				top:800px;
				height:100px;
				width:100px;
				background-color: red;
			}
		</style>
	</head>
	<body>
		<div id="box"></div>
		<script>
			let box=document.getElementById("box");
			let ob=new IntersectionObserver(changes => {
				// 交叉状态改变，就会被触发执行
				console.log(changes);
			},{
				threshold:[1]
			})
			//监听box
			ob.observe(box);
			//取消监听 unobserve
		</script>
	</body>
</html>
